﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageNews.aspx.cs" Inherits="Manageweb_ManageNews_ManageNews" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    
<link href="../images/css.css" rel="stylesheet" type="text/css" />
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table width="750" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td style="background-color:#507cd1; color:White; font-weight:bold; text-align:left;">
            &nbsp;管理文章&nbsp;</td>
      </tr>
    </table>
    <br />
    <table width="750" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td style="width:50%; text-align: left;">&nbsp;<asp:TextBox ID="TB_Search" runat="server" Width="240px"></asp:TextBox>
            <asp:Button ID="Btn_Search" runat="server" Text="搜索" ValidationGroup="Btn_Search" OnClick="Btn_Search_Click" />
            <asp:RequiredFieldValidator ID="RFV_TB_Search" runat="server" ControlToValidate="TB_Search"
                Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_Search"></asp:RequiredFieldValidator></td>
        <td style="text-align: left">&nbsp;<asp:DropDownList ID="DDL_Class" runat="server" Width="240px">
            </asp:DropDownList>
            <asp:Button ID="Btn_AddNews" runat="server" Text="添加文章" ValidationGroup="Btn_AddNews" OnClick="Btn_AddNews_Click" />
            <asp:RequiredFieldValidator ID="RFV_DDL_Class" runat="server" ControlToValidate="DDL_Class"
                Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_AddNews"></asp:RequiredFieldValidator></td>
      </tr>
    </table>
    <br />
        <asp:Label ID="LB_ManageNews" runat="server" Font-Bold="True" Font-Size="Small" ForeColor="Red"></asp:Label>
        <table border="1" cellpadding="0" cellspacing="0" width="750">
            <tr>
                <td>
                    <asp:GridView ID="GV_NewsList" runat="server" AllowPaging="True" AllowSorting="True"
                        AutoGenerateColumns="False" CellPadding="4" DataSourceID="ODS_NewsList" ForeColor="#333333" PageSize="15" Width="100%">
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <Columns>
                            <asp:BoundField DataField="News_ID" HeaderText="News_ID" InsertVisible="False" SortExpression="News_ID"
                                Visible="False" />
                            <asp:BoundField DataField="News_Title" HeaderText="标题" SortExpression="News_Title" />
                            <asp:BoundField DataField="NC_Title" HeaderText="类别" SortExpression="NC_Title" />
                            <asp:TemplateField HeaderText="启用/锁定" SortExpression="News_IsLock">
                                <ItemTemplate>
                                    <asp:Button ID="Btn_IsLock" runat="server" Text='<%# FormatIsLock(Eval("News_IsLock")) %>' CommandArgument='<%# Eval("News_ID") %>' OnCommand="Btn_IsLock_Command" Width="50px" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="News_Order" HeaderText="排序" SortExpression="News_Order" Visible="False" />
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:Button ID="Btn_Mod" runat="server" CommandArgument='<%# Eval("News_ID") %>'
                                        OnCommand="Btn_Mod_Command" Text="修改" />
                                    <asp:Button ID="Btn_Del" runat="server" CommandArgument='<%# Eval("News_ID") %>'
                                        OnClientClick="return confirm('确认操作？')" OnCommand="Btn_Del_Command"
                                        Text="删除" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="News_DateTime" HeaderText="创建时间" SortExpression="News_DateTime" />
                        </Columns>
                        <RowStyle BackColor="#EFF3FB" />
                        <EditRowStyle BackColor="#2461BF" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                    <asp:ObjectDataSource ID="ODS_NewsList" runat="server" OldValuesParameterFormatString="original_{0}"
                        SelectMethod="GetDataOrderByDateTime" TypeName="AccessDAL.NewsTableAdapters.NC_NTableAdapter">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="false" Name="News_IsDel" Type="Boolean" />
                            <asp:Parameter DefaultValue="false" Name="NC_IsLock" Type="Boolean" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="ODS_NewsList2" runat="server" OldValuesParameterFormatString="original_{0}"
                        SelectMethod="GetDataByClassCodeOrderByDateTime" TypeName="AccessDAL.NewsTableAdapters.NC_NTableAdapter">
                        <SelectParameters>
                            <asp:SessionParameter Name="News_ClassCode" SessionField="NewsClassCode" Type="String" />
                            <asp:Parameter DefaultValue="false" Name="News_IsDel" Type="Boolean" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                    <asp:ObjectDataSource ID="ODS_Search" runat="server" OldValuesParameterFormatString="original_{0}"
                        SelectMethod="GetDataByLikeTitleOrderByDateTime" TypeName="AccessDAL.NewsTableAdapters.NC_NTableAdapter">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="TB_Search" Name="News_Title" PropertyName="Text"
                                Type="String" />
                            <asp:Parameter DefaultValue="false" Name="News_IsDel" Type="Boolean" />
                        </SelectParameters>
                    </asp:ObjectDataSource>
                </td>
            </tr>
        </table>
    
    </div>
    </form>
</body>
</html>
